<?php

/**
 * Mailing form.
 *
 * @package    Sanitas
 * @subpackage form
 * @author     Jose Antonio Sánchez Bedoya
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class MailingForm extends BaseMailingForm
{
  public function configure()
  {
        //Following code will remove Required validators from these fields.
  	unset($this->validatorSchema['created_at']);
  	unset($this->validatorSchema['updated_at']);
  	
  	//following code will remove fields from form
  	unset($this->widgetSchema['created_at']);
  	unset($this->widgetSchema['updated_at']);
  	
  	$this->widgetSchema['fecha_lanzamiento'] = new sfWidgetFormJQueryDate(array(
    	       //'format' => '%date%', 
  	           'culture' => sfContext::getInstance()->getUser()->getCulture(),
                   'image' => '/images/calendar.gif',
  	)); 
        
  	$this->widgetSchema['fecha_lanzamiento']->getOption('date_widget')->setOption('format', '%day%/%month%/%year%');
        
        $this->widgetSchema['texto'] = new sfWidgetFormTextareaTinyMCE(array(
            'width'  => 750,
            'height' => 200,
            'config' => 'theme_advanced_disable: "anchor,image,cleanup,help",
                         theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,bullist,numlist,separator,sub,sup,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,fontselect,fontsizeselect,forecolor,backcolor,separator,code"',
        ));
        
        $this->setWidget('adjunto1', new sfWidgetFormInputFile( ));
        $this->validatorSchema['adjunto1'] = new sfValidatorFile(array(
	                'required'      => false,	                
	                'max_size'      => '1048576',
	                'path'          => sfConfig::get('app_email_attachments'),
	            )); 

        
        $this->setWidget('adjunto2', new sfWidgetFormInputFile( ));
        $this->validatorSchema['adjunto2'] = new sfValidatorFile(array(
	                'required'      => false,	                
	                'max_size'      => '1048576',
	                'path'          => sfConfig::get('app_email_attachments'),
	            )); 

       
        // Para añadir el nombre del cliente_id
        $this->validatorSchema->setOption('allow_extra_fields', true);
        $this->setWidget('grupo_id', new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Grupo'), 'add_empty' => true)));
        
      
        $this->validatorSchema['asunto'] = new sfValidatorString(array('max_length' => 100, 'required' => true));
        $this->validatorSchema['fecha_lanzamiento'] = new sfValidatorDate(array('required' => true));
  	$this->validatorSchema['texto'] = new sfValidatorString(array('required' => false));
        
      
      
  }
}
